home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1987 February / Ahoy_Magazine_87-02_1987_Double_L.d64 / Six Couples (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  626b  |  23 lines

  1. 0 rem << cd38-6 >>
  2. 1 rem commodares problem #34-4:
  3. 2 print" six couples"
  4. 3 rem solution by
  5. 4 rem     bill hoyt
  6. 5 rem
  7. 10 dim sp$(2,12),t(12)
  8. 20 data a,ts,b,,c,ys,d,td,e,t,f,yt,p,yds,q,ytd,r,,s,ds,t,yd,u,s
  9. 30 a$="ytds"
  10. 40 for n=1 to 12 : read sp$(1,n),sp$(2,n) : next n
  11. 50 for n=1 to 4 : ct=ct+asc(mid$(a$,n,1)) : next
  12. 60 for x=1 to 12 : vx=0
  13. 70 lx=len(sp$(2,x)) : if lx=0 then 90
  14. 80 for n=1 to lx : vx=vx+asc(mid$(sp$(2,x),n,1)) : next n
  15. 90 t(x)=vx : next x
  16. 100 for x=1 to 11 : for y=x+1 to 12
  17. 110 if t(x)+t(y)<>ct then 140
  18. 120 print sp$(1,x)" & "sp$(1,y)
  19. 130 sp$(0,x)="*" : sp$(0,y)="*"
  20. 140 next y : next x
  21. 150 for n=1 to 12 : if sp$(0,n)<>"*" then print sp$(1,n)" unmatched "sp$(2,n)
  22. 160 next n
  23.